package com.android.vtca.lib.game2d;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;

public class Sprite {

	private Bitmap bmImage;
	private int x, y;

	public Sprite() {
	}

	public Sprite(Context context, int iImage) {
		bmImage = BitmapFactory.decodeResource(context.getResources(), iImage);

	}

	public void setPisition(int x, int y) {
		this.x = x;
		this.y = y;
	}

	public int getWidth() {
		return bmImage.getWidth();
	}

	public int getHeight() {
		return bmImage.getHeight();
	}

	public void DrawIamge(Canvas canvas) {
		canvas.drawBitmap(bmImage, x, y, new Paint());
	}

	public boolean isClick(int x, int y) {
		if (x < this.x || x > this.x + bmImage.getWidth() || y < this.y
				|| y > this.y + bmImage.getHeight()) {
			return false;
		}
		return true;
	}

}
